<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document Title</title>
    <style>
        .actived {
            color: red;
        }
        .mylink {
            cursor: pointer;
        }
    </style>
</head>

<body>
<h1>Vue的样式绑定</h1>
<hr>
<div id="app">
    <div @click="handleClick" :class="[active,link]">Hello World</div>
</div>
<!--使用CDN方式引入vue-->
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.4/vue.min.js"></script>
<script>
    let vm = new Vue({
        el: '#app',
        data: {
            active: '',
            link: 'mylink'
        },
        methods: {
            handleClick: function () {
                this.active = this.active === 'actived' ? '' : 'actived';
            }
        }
    })
</script>
</body>
</html>
